package com.zhike.b2b.stock.impl;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.saas.biz.dao.stockorderDAO.StockorderExt;
import com.saas.biz.paramMgr.ParamInfo;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import com.zhike.b2b.dao.Dbtable;
import com.zhike.b2b.util.StringUtil;

public class StockInfo
{
  Dbtable tradeQuery = new Dbtable();
  Logger log = new Logger(this);
  Buffers inBuffer;
  Buffers outBuffer;
  ArrayList queryResult = new ArrayList();
  SimpleDateFormat formate = new SimpleDateFormat("yyyy-MM-dd");
  private String pass_show = ParamInfo.getIsPassShow();

  public void setTradeQuery(Dbtable paramDbtable)
  {
    this.tradeQuery = paramDbtable;
  }

  public Dbtable getTradeQuery()
  {
    return this.tradeQuery;
  }

  public void setOutBuffer(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
  }

  public Buffers getOutBuffer()
  {
    return this.outBuffer;
  }

  public ArrayList getQueryResult()
  {
    return this.queryResult;
  }

  public void setQueryResult(ArrayList paramArrayList)
  {
    this.queryResult = paramArrayList;
  }
  
  
  public List<Map> getNewestBuyList(int start, int size)
  {
	  String sql = " select b.buying_id  buying_id  ,b.class_id class_id,BUYING_NAME name,publish_date,sc.article_rule rule,sc.store_path store_path from buying b   left join buying_class as sc on sc.class_id = b.class_id  where b.start_date <=now() and b.end_date >=now() and b.display=1 and b.validity =1  order by  b.oper_time desc ";
	  sql += " limit "+start+","+size ;
	  ArrayList<HashMap> data = null;
	  List<Map> lm = new ArrayList<Map>();
	  String name,url,date;
	  for(HashMap hm : data)
	  {
		  Map vm = new HashMap();
		  String sp = hm.get("store_path") + "";
		  String str5 = hm.get("rule").toString();
		  if (str5.indexOf("{class_id}") != -1)
		      str5 = str5.replace("{class_id}", hm.get("class_id").toString());
		  if (str5.indexOf("{fid}") != -1)
		      str5 = str5.replace("{fid}", hm.get("buying_id").toString());
		  url = sp + str5;
		  vm.put("url", url);
		  
		  name = hm.get("name").toString();
		  name = StringUtil.truncate(name, 15, true);
		  vm.put("name", name);
		  
		  date = hm.get("publish_date").toString();
		  date = date.substring(0,10);
		  vm.put("date", date);
		  lm.add(vm);
	  }
	  return lm;
  }

  public ArrayList selNews(int paramInt1, int paramInt2, String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getNewsListByTitles方法...");
    if (paramInt1 > 1)
      paramInt1 = (paramInt1 - 1) * paramInt2;
    else
      paramInt1 = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString2);
    if (paramString1.equals(""))
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    if (paramString3.equals(""))
      localStockorderExt.setParam(":VVALIDITY", "%");
    else
      localStockorderExt.setParam(":VVALIDITY", "%" + paramString3 + "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_NT_AMAND", paramInt1, paramInt2);
    return localArrayList;
  }

  public int selNews(String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString2);
    if (paramString1.equals(""))
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    if (paramString3.equals(""))
      localStockorderExt.setParam(":VVALIDITY", "%");
    else
      localStockorderExt.setParam(":VVALIDITY", "%" + paramString3 + "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_NT_AMAND");
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public ArrayList selNews(int begin, int size, String buyingName, String custId, String validity, String start, String end, String paramString6)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getNewsListByTitles方法...");
    if (begin > 1)
      begin = (begin - 1) * size;
    else
      begin = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", custId);
    if (buyingName.equals(""))
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%" + buyingName + "%");
    if (validity.equals(""))
      localStockorderExt.setParam(":VVALIDITY", "%");
    else
      localStockorderExt.setParam(":VVALIDITY", "%" + validity + "%");
    if (paramString6.equals(""))
      localStockorderExt.setParam(":VCLASS_ID", "%");
    else
      localStockorderExt.setParam(":VCLASS_ID", "%" + paramString6 + "%");
    if ((!"".equals(start)) && (!"".equals(end)))
    {
      localStockorderExt.setParam(":VSTART", start);
      localStockorderExt.setParam(":VEND", end);
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_DATE", begin, size);
    }
    else if (("".equals(start)) && (!"".equals(end)))
    {
      localStockorderExt.setParam(":VEND", end);
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_END", begin, size);
    }
    else if ((!"".equals(start)) && ("".equals(end)))
    {
      localStockorderExt.setParam(":VSTART", start);
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_START", begin, size);
    }
    else
    {
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_ALL", begin, size);
    }
    return localArrayList;
  }

  public int selNews(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString2);
    if (paramString1.equals(""))
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    if (paramString3.equals(""))
      localStockorderExt.setParam(":VVALIDITY", "%");
    else
      localStockorderExt.setParam(":VVALIDITY", "%" + paramString3 + "%");
    if (paramString6.equals(""))
      localStockorderExt.setParam(":VCLASS_ID", "%");
    else
      localStockorderExt.setParam(":VCLASS_ID", "%" + paramString6 + "%");
    if ((!"".equals(paramString4)) && (!"".equals(paramString5)))
    {
      localStockorderExt.setParam(":VSTART", paramString4);
      localStockorderExt.setParam(":VEND", paramString5);
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_DATE");
    }
    else if (("".equals(paramString4)) && (!"".equals(paramString5)))
    {
      localStockorderExt.setParam(":VEND", paramString5);
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_END");
    }
    else if ((!"".equals(paramString4)) && ("".equals(paramString5)))
    {
      localStockorderExt.setParam(":VSTART", paramString4);
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_START");
    }
    else
    {
      localArrayList = localStockorderExt.selByList("SEL_ALL_BUYING_BY_ALL");
    }
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public ArrayList yysselNews(int paramInt1, int paramInt2, String paramString1, String paramString2)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getNewsListByTitles方法...");
    if (paramInt1 > 1)
      paramInt1 = (paramInt1 - 1) * paramInt2;
    else
      paramInt1 = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    if (paramString1 != null)
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    if (paramString2 != null)
      localStockorderExt.setParam(":VCUST_NAME", "%" + paramString2 + "%");
    else
      localStockorderExt.setParam(":VCUST_NAME", "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_INFO", paramInt1, paramInt2);
    return localArrayList;
  }

  public int yysselNews(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    if (paramString1 != null)
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    if (paramString2 != null)
      localStockorderExt.setParam(":VCUST_NAME", "%" + paramString2 + "%");
    else
      localStockorderExt.setParam(":VCUST_NAME", "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_INFO");
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public ArrayList selNewsRepub(int paramInt1, int paramInt2, String paramString1, String paramString2)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getNewsListByTitles方法...");
    if (paramInt1 > 1)
      paramInt1 = (paramInt1 - 1) * paramInt2;
    else
      paramInt1 = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    if (paramString1 != null)
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    if (paramString2 != null)
      localStockorderExt.setParam(":VCUST_NAME", "%" + paramString2 + "%");
    else
      localStockorderExt.setParam(":VCUST_NAME", "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_REPUB", paramInt1, paramInt2);
    return localArrayList;
  }

  public int selNewsRepub(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    if (paramString1 != null)
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    if (paramString2 != null)
      localStockorderExt.setParam(":VCUST_NAME", "%" + paramString2 + "%");
    else
      localStockorderExt.setParam(":VCUST_NAME", "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_REPUB");
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public ArrayList getStockCheck(int paramInt1, int paramInt2, String paramString1, String paramString2)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getNewsListByTitles方法...");
    if (paramInt1 > 1)
      paramInt1 = (paramInt1 - 1) * paramInt2;
    else
      paramInt1 = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    if (paramString1 != null)
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    if (paramString2 != null)
      localStockorderExt.setParam(":VCUST_NAME", "%" + paramString2 + "%");
    else
      localStockorderExt.setParam(":VCUST_NAME", "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_CHECK", paramInt1, paramInt2);
    return localArrayList;
  }

  public int getStockCheck(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    if (paramString1 != null)
      localStockorderExt.setParam(":VBUYING_NAME", "%" + paramString1 + "%");
    else
      localStockorderExt.setParam(":VBUYING_NAME", "%");
    if (paramString2 != null)
      localStockorderExt.setParam(":VCUST_NAME", "%" + paramString2 + "%");
    else
      localStockorderExt.setParam(":VCUST_NAME", "%");
    localArrayList = localStockorderExt.selByList("SEL_ALL_NEWS_CHECK");
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public int getStockInfoByCount()
    throws SaasApplicationException
  {
    StockorderExt localStockorderExt = new StockorderExt();
    ArrayList localArrayList = localStockorderExt.selByList("SEL_BY_VIEW_COUNT");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return localArrayList.size();
    return 0;
  }

  public ArrayList getNewStockInfoByList(int paramInt1, int paramInt2)
    throws SaasApplicationException
  {
    if (paramInt1 > 1)
      paramInt1 = (paramInt1 - 1) * paramInt2;
    else
      paramInt1 = 0;
    Calendar localCalendar = Calendar.getInstance();
    String str1 = this.formate.format(localCalendar.getTime());
    localCalendar.add(2, 1);
    String str2 = this.formate.format(localCalendar.getTime());
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VSTART_DATE", str1);
    localStockorderExt.setParam(":VEND_DATE", str2);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_NEW_BY_VIEW", paramInt1, paramInt2);
    return localArrayList;
  }

  public int getNewStockInfoByCount()
    throws SaasApplicationException
  {
    Calendar localCalendar = Calendar.getInstance();
    String str1 = this.formate.format(localCalendar.getTime());
    localCalendar.add(2, 1);
    String str2 = this.formate.format(localCalendar.getTime());
    int i = 0;
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VSTART_DATE", str1);
    localStockorderExt.setParam(":VEND_DATE", str2);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_NEW_BY_VIEW_CT");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      i = Integer.parseInt(localHashMap.get("ct").toString());
    }
    return i;
  }

  public HashMap getStockInfoById(String paramString)
    throws SaasApplicationException
  {
    HashMap localHashMap = new HashMap();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VSTOCK_ID", paramString);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_VIEW_BY_ID");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      localHashMap = (HashMap)localArrayList.get(0);
    return localHashMap;
  }

  public ArrayList getProductByStock(int paramInt, String paramString1, String paramString2, String paramString3, String paramString4)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getProductByStock方法");
    if (paramInt > 1)
      paramInt = (paramInt - 1) * 10;
    else
      paramInt = 0;
    Calendar localCalendar = Calendar.getInstance();
    if ("".equals(paramString1))
      paramString1 = "%";
    if ("".equals(paramString2))
      paramString2 = "%";
    if ("".equals(paramString3))
      paramString3 = "%";
    if ("".equals(paramString4))
      paramString4 = "365";
    localCalendar.add(5, Integer.parseInt(paramString4) - Integer.parseInt(paramString4) * 2);
    String str = new SimpleDateFormat("yyyy-MM-dd").format(localCalendar.getTime());
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    this.log.LOG_INFO("=========================stock_key=" + paramString1 + "=============pro=" + paramString2 + "=========city=" + paramString3 + "==========date_scope1=" + str);
    localStockorderExt.setParam(":VSTOCK_KEY", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VPRO", "%" + paramString2 + "%");
    localStockorderExt.setParam(":VCITY", "%" + paramString3 + "%");
    localStockorderExt.setParam(":VDATE", str);
    localArrayList = localStockorderExt.selByList("SEL_PRODUCT_BY_STOCK", paramInt, 10);
    this.log.LOG_INFO("退出getProductByStock方法");
    return localArrayList;
  }

  public int getProductByStock(String paramString1, String paramString2, String paramString3, String paramString4)
    throws SaasApplicationException
  {
    int i = 0;
    StockorderExt localStockorderExt = new StockorderExt();
    Calendar localCalendar = Calendar.getInstance();
    if ("".equals(paramString1))
      paramString1 = "%";
    if ("".equals(paramString2))
      paramString2 = "%";
    if ("".equals(paramString3))
      paramString3 = "%";
    if ("".equals(paramString4))
      paramString4 = "365";
    localCalendar.add(5, Integer.parseInt(paramString4) - Integer.parseInt(paramString4) * 2);
    String str = new SimpleDateFormat("yyyy-MM-dd").format(localCalendar.getTime());
    localStockorderExt.setParam(":VSTOCK_KEY", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VPRO", "%" + paramString2 + "%");
    localStockorderExt.setParam(":VCITY", "%" + paramString3 + "%");
    localStockorderExt.setParam(":VDATE", str);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_PRODUCT_BY_STOCK");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      i = localArrayList.size();
    return i;
  }

  public ArrayList getProductByStockOffCity(int paramInt, String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getProductByStock方法");
    if (paramInt > 1)
      paramInt = (paramInt - 1) * 10;
    else
      paramInt = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VSTOCK_KEY", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VPRO", "%" + paramString2 + "%");
    localStockorderExt.setParam(":VPART", paramString3);
    localArrayList = localStockorderExt.selByList("SEL_PRODUCT_BY_STOCK_CT", paramInt, 10);
    this.log.LOG_INFO("退出getProductByStock方法");
    return localArrayList;
  }

  public int getProductByStockOffCity(String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    int i = 0;
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VSTOCK_KEY", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VPRO", "%" + paramString2 + "%");
    localStockorderExt.setParam(":VPART", paramString3);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_PRODUCT_BY_STOCK_CT");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      i = localArrayList.size();
    return i;
  }

  public ArrayList getProductByStockOffKey(int paramInt, String paramString1, String paramString2)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getProductByStock方法");
    if (paramInt > 1)
      paramInt = (paramInt - 1) * 10;
    else
      paramInt = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VPRO", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VPART", paramString2);
    localArrayList = localStockorderExt.selByList("SEL_PRODUCT_BY_NO_KEY", paramInt, 10);
    this.log.LOG_INFO("退出getProductByStock方法");
    return localArrayList;
  }

  public int getProductByStockOffKey(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    int i = 0;
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VPRO", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VPART", paramString2);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_PRODUCT_BY_NO_KEY");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      i = localArrayList.size();
    return i;
  }

  public ArrayList getProductByOff(int paramInt, String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("进入getProductByStock方法");
    if (paramInt > 1)
      paramInt = (paramInt - 1) * 10;
    else
      paramInt = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VPRO", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VCITY", "%" + paramString2 + "%");
    localStockorderExt.setParam(":VPART", paramString3);
    localArrayList = localStockorderExt.selByList("SEL_PRODUCT_NO_KEY", paramInt, 10);
    this.log.LOG_INFO("退出getProductByStock方法");
    return localArrayList;
  }

  public int getProductByOff(String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    int i = 0;
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VPRO", "%" + paramString1 + "%");
    localStockorderExt.setParam(":VCITY", "%" + paramString2 + "%");
    localStockorderExt.setParam(":VPART", paramString3);
    ArrayList localArrayList = localStockorderExt.selByList("SEL_PRODUCT_NO_KEY");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      i = localArrayList.size();
    return i;
  }

  public ArrayList getOtherInfoByCust(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString);
    localArrayList = localStockorderExt.selByList("SEL_OTHER_BY_CUST_ID");
    return localArrayList;
  }

  public ArrayList getStockInfoListIndex(int paramInt1, int paramInt2, String paramString)
    throws SaasApplicationException
  {
    if (paramInt1 > 1)
      paramInt1 = (paramInt1 - 1) * paramInt2;
    else
      paramInt1 = 0;
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString);
    localArrayList = localStockorderExt.selByList("SEL_BY_QIUGOU_OUT_TIME_CONUT_INDEX", paramInt1, paramInt2);
    return localArrayList;
  }

  public int getCountIndex(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString);
    localArrayList = localStockorderExt.selByList("SELECT_ALL_BY_CUST_ID");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return localArrayList.size();
    return 0;
  }

  public int getCount(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCUST_ID", paramString);
    localArrayList = localStockorderExt.selByList("SELECT_ALL_BY_CUST_ID");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return localArrayList.size();
    return 0;
  }

  public int getCountByClassId(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCLASS_ID", paramString + "%");
    localArrayList = localStockorderExt.selByList("SELECT_ALL_BY_CLASS_ID");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return localArrayList.size();
    return 0;
  }

  public ArrayList getNameByClassId(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    StockorderExt localStockorderExt = new StockorderExt();
    localStockorderExt.setParam(":VCLASS_ID", paramString);
    localArrayList = localStockorderExt.selByList("SELECT_ALL_BY_CLASS_ID_FOR_NAME");
    return localArrayList;
  }
}

